<php>$meta_title = "入库列表";</php>
<include file="Public:header" />
<tagLib name="html" />
<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
  
<!--  功能组区域  -->
<div class="btn-toolbar">
    <div class="btn-group">
  	<button class="btn btn-primary" onclick="add()"><i class="icon-plus icon-white"></i> 新增</button>
  	<button class="btn btn-primary" onclick="edit()"><i class="icon-edit icon-white"></i> 编辑</button>
  	<button class="btn btn-primary" onclick="print()"><i class="icon-print icon-white"></i> 打印入库单</button>
    <!--<button class="btn btn-primary" onclick="fastadd()"><i class="icon-edit icon-white"></i> 导入采购</button> -->
  	<button class="btn btn-primary" onclick="foreverdel()"><i class="icon-trash icon-white"></i> 删除</button>
    </div>
	导出
		<a href="__URL__/export_order?{$parameters}&etype=order&action={:ACTION_NAME}" class="btn">入库单</a>
		<a href="__URL__/export_order?{$parameters}&etype=detail&action={:ACTION_NAME}" class="btn">明细</a>
    <span class="label label-success">总金额：{$sum_overview.sum_total}  总数量：{$sum_overview.sum_number} </span>
	<form class="search-form" method='get' action="__URL__">

		每页显示 <input type="text" class="span1" name="listRows" value="{$_REQUEST.listRows}">
		供应商:{:modList('Supplier' ,$_REQUEST['supplier_id'],'span1')}
		入库时间 从<input type="text" class="span2"  name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<notempty name='_REQUEST.start_time'>{$_REQUEST.start_time}</notempty>">
		到<input type="text" class="span2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="end_time" id="end_time" value="<notempty name='_REQUEST.end_time'>{$_REQUEST.end_time}</notempty>" >

		<input type="text" class="search-query span2" name="keywords" <notempty name='_REQUEST.keywords'>
		<php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php>
		<else/>
		placeholder="按产品信息搜索"
	</notempty>
	>
    <!--采购单号
	<input type="text" class="search-query span2" name="buy_no" <notempty name='_REQUEST.buy_no'>
		<php>echo 'value="'.urldecode($_REQUEST['buy_no']).'"'</php>
		<else/>
		placeholder="按采购单号搜索"
	</notempty>
	> -->  入库单号
	<input type="text" class="search-query span2" name="enter_no" <notempty name='_REQUEST.enter_no'>
		<php>echo 'value="'.urldecode($_REQUEST['enter_no']).'"'</php>
		<else/>
		placeholder="按入库单号搜索"
	</notempty>
	>
	<input type="submit" class="btn btn-primary" value="搜索">
	</form>
  </div>
<!-- 功能组区域结束 -->
<php>
    function detail($id){
    echo ('<a href="__APP__/Enter_detail/index/enter_id/'.$id.'">入库明细</a>');
    }
    function fastadd($id){
     echo ('<a href="__APP__/Sale/fastadd/enter_id/'.$id.'">快速出货</a>');
    }
    function getBuyNo($buy_id){
      return getModelName($buy_id,'Buy','buy_no');
  }

</php>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div><html:list id="checkList" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" show="id:编号|5%:edit,enter_no:入库单号,buy_id|getBuyNo:采购单号,total:总金额,sum_number:总数量,supid|getModelName=Supplier:供应商,user_id|getModelName=User:经办人,create_time|toDate:入库时间,id|detail:入库明细" actionlist="addpt:增录产品:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 --><include file="Public:footer"/>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<script type="text/javascript">
  function fastadd(){
    location.href=URL+"/fastadd";
  }

//增录产品
  function addpt(id){
    location.href=APP+"/Enter_detail/add/id/"+id;
  }

  function print(id){
    var keyValue;
    if (id)
    {
      keyValue = id;
    }else {
      keyValue = getSelectCheckboxValue();
    }
    if (!keyValue)
    {
      alert('请选择入库单！');
      return false;
    }

	window.open(APP+"/Enter/print_enter/id/"+keyValue, '_blank' );
    
 }

  function quicksale(id){
    var keyValue;
    if (id)
    {
      keyValue = id;
    }else {
      keyValue = getSelectCheckboxValues();
    }
    if (!keyValue)
    {
      alert('请选择入库单！');
      return false;
    }
    location.href=APP+"/Sale/fastadd/enter_id/"+keyValue;
  }
</script>

